<template>
  <div class="merchant alltable">
    <div class="tabbar">
      <div class="let">
             
        <Input
          prefix="ios-search"          
          v-model.trim="data_axios.selectinfo"
          placeholder="请输入关键字"
          style="width: 200px"
        />
        <Button class="btn_default" @click="search">
          <Icon type="ios-search" size="17" class="icon_wy"/>查询
        </Button>
      </div>
        <div class='rit'>              
            <!-- <Button @click="model2=true" ><Icon type="ios-add-circle-outline" size="17" class="icon_wy"/>添加结算单</Button> -->
      </div>
    </div>
    <div class="tabble">
      <div>
        <Table
          :columns="columns"
          :loading="loading"
          height="560"
          :data="data.datas"
          class="sel_table"
        ></Table>
      </div>
    </div>

    <div class="tab_pages">
      <Page
        :total="data.allCount"
        :page-size="data_axios.pagesize"
        :current.sync="data_axios.pagenumber"
        show-total
        @on-change="merchant_data"
      >
      </Page>
    </div>
    
  </div>
</template>
<script>
import { setAdmin, setToken, getAdmin } from "../../../utils/auth.js";
import { selectStaffList} from "../../../apis/api_system.js";
import filter from './../../../filters/filter';
// import { validatePhone ,validateIdnumber} from "../../../utils/validate.js";
export default {
  name: "bus_listing",
  data() {
    return {
     
      data: {        
        datas: [],        
      },
      data_axios: {        
        pagesize: 10,
        pagenumber: 1,        
        selectinfo: "",        
      },
      fix_data:{
      },
      add_data:{
        midlist: [],
        startday:"",
        endday:"",
      },
      loading: false,
      Mnamelist: [],
      
      columns: [
        {
          title: "序号",
          key: "name",
          type: "index",
          width: 50
        },
        {
          title: "名字",
          key: "name"
        },
        {
          title: "电话",
          key: "tel",
        //    width: 100
        },
        {
          title: "创建时间",
          key: "createdate"
        },
        {
          title: "创建人",
          key: "createusername",
        //   width: 100
        },
         {
          title: "修改人",
          key: "modifyusername",
        //   width: 100
        },
         {
          title: "修改时间",
          key: "modifydate",
        //   width: 100
        },
        {
          title: "身份 ",
          key: "type",
          render: (h, params) => {
            const row = params.row;
            var text ='';
            if( row.type==1){
                text="超管"
            }else{
                text='普通员工'
            }
            return <span>{text}</span>;
          }
        },  
      ],
      
    };
  },
  
  mounted() {    
    let info = getAdmin();   
    this.userId = info.id;
    this.userName = info.name;        
    this.selectStaffList(this.data_axios);    
  },
  methods: {
    //   获取员工列表
    selectStaffList(info) {
        this.loading = true;          
      let data = JSON.stringify({
        requestString: JSON.stringify(info),
        userId: this.userId,
        fullname: "员工列表"
      });     
      selectStaffList(data).then(({ returnString, code, disp ,count}) => {
          this.loading = false;
          if (code == 200) { 
            // console.log(this.data)
            this.data.datas = returnString;
            // this.data.allCount = count;            
          } else {            
            this.$Message.warning(disp);
          }
        })
        .catch(err => {
            this.$Message.warning('请求出错');
        });
    },
    
   
    //分页改变
    merchant_data() {
       this.selectStaffList(this.data_axios);
    },
    search(){
      this.data_axios.pagenumber=1;
      this.selectStaffList(this.data_axios);
    },
    
  }
};
</script>
<style scoped=true>
  .ivu-checkbox-group{
    display: inline-block;
  }
</style>